Skip to main content

Static HTML

Since the interpretation of the output cells happens in a browser, then we can pack all data into a single .html file and easily share it with other people by clicking on the icon

Save your notebook and click Share icon

warning

Do not forget to save your notebook before exporting! It is important for garbage collecting

Use cases

  • Share a notebook with a colleague (no WLJS App installed)
  • Share your work on the internet or embed it to a blog post. Using URL Protocol other users can convert it back to a normal WLJS notebook
  • Make a report on data analysis, experiment
  • Documentation
  • Cross-platform personal notes

Example

info

All dynamic content will be frozen at the latest state you have evaluated

Hosting notebooks

Offline mode

This is a default behavior, when it packs all libraries for graphics and ui into a single HTML file. It results in a quite bulky file ~5-15 mb depending how many things were included (see Portability), that can work fully offline.

CDN mode

This is can be enabled form the settings menu

Then the bare minimum of data will be compressed into a single HTML, mostly an actual data of the notebook. It results in a much smaller file size, however, requires an internet connection. We use JSDelivr to ship all libraries from the corresponding Github repositories.

Then one can embed a notebook as <iframe> into your blog or as a normal static page using services such as Static App for example.

URL Protocol

See more in URL Protocol

Portability

Once exported, an .html file can be unpacked back to a normal notebook once opened using WLJS Notebook app. There are some limitations

  • no external files, except images will be packaged
  • iconized expressions to a file will be lost

However,

  • all static graphs, 2D, 3D graphics are kept
  • all external images are kept and embedded to a document (including slides and md)
  • NotebookStore data is embedded as well
  • slides as well as all cell are kept press f to go fullscreen. Actually there is separate option on how to export slides for printing - see Export Slides

You can specify what to include to the bundle and what to exclude in Settings menu

Limitations for user's dynamic content

Things such as ManipulatePlot, InputRange, Offload technic, animations made using AnimationFrameListener or SetInterval and similar will not work and display the last state in your HTML document.

Option 1

To overcome this limitations one can use Dynamic HTML instead, which is still experimental feature.

Option 2

However, functions such as

will still work being exported to a static HTML file out of the box, since they pre-calculate all frames in advance and store them in the notebook.